<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

    require APPPATH.'libraries/REST_Controller.php';
    class Service extends REST_Controller {

        public function __construct(){
            parent::__construct();

            $this->load->model('excursions_model');

            /* Translate Class */
            $this->load->library('translate');

            /* Translate Language */
            $this->translate->setLang($this->input->get_post('lang'));
        }

        public function index() { $this->response(NULL,404); }

        public function excursions_post(){

            $excursions = $this->excursions_model->get_all();

            /*foreach ($excursions as $excursion):
            echo $excursion['title']."<br />";    
            endforeach;*/                         
            //print_r($excursions);

            if($excursions){
                $this->response($excursions,200);
            }

            else{
                $this->response(NULL,404);
            }

        } 

        public function details_get(){

            $excursion = $this->excursions_model->get_excursion();        

            if($excursion){
                $this->response($excursion,200);
            }

            else{
                $this->response(NULL,404);
            }

        }

        public function gallery_get(){

            $gallery = $this->excursions_model->get_images();

            if($gallery){
                $this->response($gallery,200);
            }

            else{
                $this->response(NULL,404);
            } 

        }

        public function check_capacity_post(){

            $capacity = $this->excursions_model->check_capacity();

            if($capacity){
                $this->response($capacity,200);
            }

            else{
                $this->response(NULL,404);
            }

        }

        public function booking_info_get(){

            $book_info = $this->excursions_model->booking_information();

            if($book_info){
                $this->response($book_info,200);
            }

            else{
                $this->response(NULL,404);
            }

        }

        public function do_booking_post(){

            $booking = $this->excursions_model->booking_write();

            if($booking){
                $this->response($booking,200);
            }

            else{
                $this->response(NULL,404);
            }

        }

        public function do_booking_new_post(){

            $booking = $this->excursions_model->booking_write_new();

            if($booking){
                $this->response($booking,200);
            }

            else{
                $this->response(NULL,404);
            }

        }

        public function total_get(){

            $total = $this->excursions_model->booking_read();

            //print_r($total);

            if($total){
                $this->response($total,200);
            }

            else{
                $this->response(NULL,404);
            }

        }
        
        public function total_tour_get(){

            $total = $this->excursions_model->booking_read_tour();

            //print_r($total);

            if($total){
                $this->response($total,200);
            }

            else{
                $this->response(NULL,404);
            }

        }

        public function action1_post(){

            $action_1 = $this->excursions_model->action('action_1');

            if($action_1){
                $this->response($action_1,200);
            }

            else{
                $this->response(NULL,404);
            }

        }

        public function action2_post(){

            $action_2 = $this->excursions_model->action('action_2');



            if($action_2){
                $this->response($action_2,200);
            }

            else{
                $this->response(NULL,404);
            }

        }

        /*TRANSACTIONS AND INVOICE TILL END OF CLASS*/
        public function show_transaction_post()
        {
            $transaction = $this->excursions_model->show_transaction();

            //print_r($total);

            if($transaction){
                $this->response($transaction,200);
            }

            else{
                $this->response(NULL,404);
            }
        }

        public function show_booking_id_post()
        {
            $booking_id = $this->excursions_model->show_booking_id();
            if($booking_id){
                $this->response($booking_id,200);
            }

            else{
                $this->response(NULL,404);
            }
        }

        public function update_status_post()
        {
            $status = $this->excursions_model->update_status();
            if($status){
                $this->response($status,200);
            }

            else{
                $this->response(NULL,404);
            }
        }

    }

    /* End of file excursions.php */
    /* Location: ./application/controllers/excursions.php */